<!DOCTYPE html>
<html>

  <head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
	<meta http-equiv="Cache-Control" content="no-siteapp" />

    <title>Xmake Getting Started Tutorial 4: C/C++ project description settings</title>
    <meta name="description" content="Xmake is a lightweight and modern C/C++ project build tool based on Lua. Its main features are: easy to use syntax, easy to use project maintenance, and a co...">

    
    <meta name="keywords" content="xmake,lua,c/c++,run,debug,tboox" /> 

    <!-- qq oauth -->
    <meta property="qc:admins" content="5211601217706727767255" />

    <!--icon -->
    <link rel="shortcut icon" href="/favicon.ico" type="image/x-icon">
    <link rel="icon" sizes="192x192" href="/static/img/nice-highres.png" />
	<link rel="apple-touch-icon-precomposed" href="/static/img/apple-touch-icon-57x57-precomposed.png" />
	<link rel="apple-touch-icon-precomposed" sizes="72x72" href="/static/img/apple-touch-icon-72x72-precomposed.png" />
	<link rel="apple-touch-icon-precomposed" sizes="114x114" href="/static/img/apple-touch-icon-114x114-precomposed.png" />
	<link rel="apple-touch-icon-precomposed" sizes="144x144" href="/static/img/apple-touch-icon-144x144-precomposed.png" />
	<link rel="apple-touch-icon-precomposed" sizes="180x180" href="/static/img/retinahd_icon.png" />
	<meta name="msapplication-TileImage" content="/static/img/retinahd_icon.png" />
	
    <link rel="stylesheet" href=" /css/fontawesome/css/font-awesome.min.css ">
    <link rel="stylesheet" href=" /css/main.css ">
    <link rel="canonical" href="https://tboox.org/2019/11/10/quickstart-4-basic-project-settings/">
    <link rel="alternate" type="application/rss+xml" title="TBOOX Open Source Project" href="https://tboox.org/feed.xml ">
    <link rel="alternate" hreflang="en" href="https://tboox.org/" />
    <link rel="alternate" hreflang="zh-Hans" href="https://tboox.org/cn/" />




    <script type="text/javascript">
    function isPC(){    
        var userAgentInfo = navigator.userAgent;  
        var Agents = new Array("Android", "iPhone", "SymbianOS", "Windows Phone", "iPad", "iPod");    
        var flag = true;    
        for (var v = 0; v < Agents.length; v++) {    
            if (userAgentInfo.indexOf(Agents[v]) > 0) { flag = false; break; }    
        }    
        return flag;    
    }
    </script>

<!-- baidu ads -->



    <!-- baidu ads -->

</head>


  <body>

    <header id="top">
    <div class="wrapper">
        <a href="/" class="brand">TBOOX</a>
        <button id="headerMenu" class="menu"><i class="fa fa-bars"></i></button>
        <nav id="headerNav">
            <ul>
                <li>
                    
                    <a href="/cn?lang=0">
                    
                        <i class="fa fa-home"></i>中文
                    </a>
                </li>

                
                    
                     
                    
                
                    
                     
                     
                    <li>

                        
                            
                            <a href="/project/">
                            
                        
                            <i class="fa fa-bookmark"></i>Projects
                        </a>
                    </li>
                    
                    
                    
                
                    
                     
                    
                
                    
                     
                     
                    <li>

                        
                            
                            <a href="/archive/">
                            
                        
                            <i class="fa fa-archive"></i>Archives
                        </a>
                    </li>
                    
                    
                    
                
                    
                     
                    
                
                    
                     
                     
                    <li>

                        
                            
                            <a href="/category/">
                            
                        
                            <i class="fa fa-th-list"></i>Categories
                        </a>
                    </li>
                    
                    
                    
                
                    
                     
                    
                
                    
                     
                     
                    <li>

                        
                            
                            <a href="/tag/">
                            
                        
                            <i class="fa fa-tags"></i>Tags
                        </a>
                    </li>
                    
                    
                    
                
                    
                
                    
                     
                    
                
                    
                     
                     
                    <li>

                        
                            
                            <a href="/docs/">
                            
                        
                            <i class="fa fa-book"></i>Documents
                        </a>
                    </li>
                    
                    
                    
                
                    
                     
                    
                
                    
                     
                     
                    <li>

                        
                            
                            <a href="https://xmake.io/#/about/contact" target="_blank" >
                            
                        
                            <i class="fa fa-forumbee"></i>Community
                        </a>
                    </li>
                    
                    
                    
                
                    
                     
                    
                
                    
                     
                     
                    <li>

                        
                            
                            <a href="/donation/">
                            
                        
                            <i class="fa fa-heart"></i>Donate
                        </a>
                    </li>
                    
                    
                    
                
                    
                     
                    
                
                    
                     
                     
                    <li>

                        
                            
                            <a href="/about/">
                            
                        
                            <i class="fa fa-user"></i>About
                        </a>
                    </li>
                    
                    
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                     
                     
                    
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
            </ul>
        </nav>
    </div>
</header>



        <div class="page clearfix" post>
    <div class="left">
        <h1>Xmake Getting Started Tutorial 4: C/C++ project description settings</h1>
        <div class="label">

            <div class="label-card">
                <i class="fa fa-calendar"></i>2019-11-10
            </div>

            <div class="label-card">
                
            </div>

            <div class="label-card">
                
            </div>

            <div class="label-card">
            


<!-- <span class="point">•</span> -->
<span class="categories">
  <i class="fa fa-th-list"></i>
  
    
        <a href="/category/#xmake" title="Category: xmake" rel="category">xmake</a>
    
  

  <!-- <span class="point">•</span> -->
</span>


            </div>

            <div class="label-card">
            
<!-- <span class="point">•</span> -->
<span class="pageTag">
  <i class="fa fa-tags"></i>
  
    
        <!--a href="/tag/#xmake" title="Tag: xmake" rel="tag">xmake</a-->
        <a href="/tag/#xmake" title="Tag: xmake" rel="tag">xmake</a>&nbsp;
    
        <!--a href="/tag/#lua" title="Tag: lua" rel="tag">lua</a-->
        <a href="/tag/#lua" title="Tag: lua" rel="tag">lua</a>&nbsp;
    
        <!--a href="/tag/#c%2Fc%2B%2B" title="Tag: c/c++" rel="tag">c/c++</a-->
        <a href="/tag/#c/c++" title="Tag: c/c++" rel="tag">c/c++</a>&nbsp;
    
        <!--a href="/tag/#run" title="Tag: run" rel="tag">run</a-->
        <a href="/tag/#run" title="Tag: run" rel="tag">run</a>&nbsp;
    
        <!--a href="/tag/#debug" title="Tag: debug" rel="tag">debug</a-->
        <a href="/tag/#debug" title="Tag: debug" rel="tag">debug</a>
    
  

</span>

            </div>

        </div>
        <hr>
        <article itemscope itemtype="http://schema.org/BlogPosting">
        <p>Xmake is a lightweight and modern C/C++ project build tool based on Lua. Its main features are: easy to use syntax, easy to use project maintenance, and a consistent build experience across platforms.</p>

<p>This article mainly explains in detail how to write some commonly used basic xmake.lua description configurations to achieve some simple C/C++ project build management.
For most small projects, these configurations are completely sufficient. In the later advanced tutorials in this series, I will explain in detail how to use some advanced features to configure the project more flexibly and customized.</p>

<ul>
  <li><a href="https://github.com/xmake-io/xmake">Project Source</a></li>
  <li><a href="https://xmake.io/">Official Documents</a></li>
</ul>

<h3 id="a-simplest-example">A simplest example</h3>

<p>One line of description compiles all c source files in the src directory, and then generates an executable file named demo.</p>

<div class="language-lua highlighter-rouge"><pre class="highlight"><code><span class="n">target</span><span class="p">(</span><span class="s2">"demo"</span><span class="p">,</span> <span class="p">{</span><span class="n">kind</span> <span class="o">=</span> <span class="s2">"binary"</span><span class="p">,</span> <span class="n">files</span> <span class="o">=</span> <span class="s2">"src/*.c"</span><span class="p">})</span>
</code></pre>
</div>

<p>The above is a condensed version. Generally, we recommend the following expansion method:</p>

<div class="language-lua highlighter-rouge"><pre class="highlight"><code><span class="n">target</span><span class="p">(</span><span class="s2">"demo"</span><span class="p">)</span>
    <span class="n">set_kind</span><span class="p">(</span><span class="s2">"binary"</span><span class="p">)</span>
    <span class="n">add_files</span><span class="p">(</span><span class="s2">"src/*.c"</span><span class="p">)</span>
</code></pre>
</div>

<p>The two are completely equivalent. If the configuration is short, it can be completely reduced to one line, and splitting into multiple lines is more convenient and flexible.</p>

<p>If there is no special purpose, we will use the second paragraph.</p>

<h3 id="configure-project-target-type">Configure project target type</h3>

<p>There are three main types of object files generated by common C/C++ projects: executable programs, static libraries, and dynamic libraries.</p>

<p>We can set it through <code class="highlighter-rouge">set_kind()</code> configuration, corresponding to: binary, static, shared</p>

<p>For example, if we want to compile the dynamic library, we just need to modify the kind:</p>

<div class="language-lua highlighter-rouge"><pre class="highlight"><code><span class="n">target</span><span class="p">(</span><span class="s2">"demo"</span><span class="p">)</span>
    <span class="n">set_kind</span><span class="p">(</span><span class="s2">"shared"</span><span class="p">)</span>
    <span class="n">add_files</span><span class="p">(</span><span class="s2">"src/*.c"</span><span class="p">)</span>
</code></pre>
</div>

<h3 id="add-macro-definition">Add macro definition</h3>

<p>The compilation macro settings are used by most c/c++ projects. Generally, if we set compilation flags to be passed to gcc/clang, we need to configure: <code class="highlighter-rouge">-DXXX</code></p>

<p>In xmake, the <code class="highlighter-rouge">add_defines()</code> built-in interface is provided for configuration:</p>

<div class="language-lua highlighter-rouge"><pre class="highlight"><code><span class="n">target</span><span class="p">(</span><span class="s2">"demo"</span><span class="p">)</span>
    <span class="n">set_kind</span><span class="p">(</span><span class="s2">"shared"</span><span class="p">)</span>
    <span class="n">add_files</span><span class="p">(</span><span class="s2">"src/*.c"</span><span class="p">)</span>
    <span class="n">add_defines</span><span class="p">(</span><span class="s2">"XXX"</span><span class="p">)</span>
</code></pre>
</div>

<h3 id="conditional-configuration">Conditional configuration</h3>

<p>What if we want to set different macro switches on different compilation platforms? We can easily implement it using lua’s built-in if statement:</p>

<div class="language-lua highlighter-rouge"><pre class="highlight"><code><span class="n">target</span><span class="p">(</span><span class="s2">"demo"</span><span class="p">)</span>
    <span class="n">set_kind</span><span class="p">(</span><span class="s2">"shared"</span><span class="p">)</span>
    <span class="n">add_files</span><span class="p">(</span><span class="s2">"src/*.c"</span><span class="p">)</span>
    <span class="n">add_defines</span><span class="p">(</span><span class="s2">"XXX"</span><span class="p">)</span>
    <span class="k">if</span> <span class="n">is_plat</span><span class="p">(</span><span class="s2">"linux"</span><span class="p">,</span> <span class="s2">"macosx"</span><span class="p">)</span> <span class="k">then</span>
        <span class="n">add_defines</span><span class="p">(</span><span class="s2">"YYY"</span><span class="p">)</span>
    <span class="k">end</span>
</code></pre>
</div>

<p>We judge by <code class="highlighter-rouge">is_plat()</code>. If the current compilation target platform is linux or macosx, then the target will additionally add the <code class="highlighter-rouge">-DYYY</code> macro definition.</p>

<h3 id="global-configuration">Global configuration</h3>

<p>All the configurations under <code class="highlighter-rouge">target("demo")</code> belong to the target subdomain of demo, not global, so you will see that the indentation is usually added to the configuration to highlight the scope of influence. .</p>

<p>Generally, if multiple targets are defined consecutively, the next target definition will automatically end the scope of the previous target. The configuration of each target is completely independent and does not interfere with each other:</p>

<div class="language-lua highlighter-rouge"><pre class="highlight"><code><span class="n">target</span><span class="p">(</span><span class="s2">"test1"</span><span class="p">)</span>
    <span class="n">set_kind</span><span class="p">(</span><span class="s2">"shared"</span><span class="p">)</span>
    <span class="n">add_files</span><span class="p">(</span><span class="s2">"src/*.c"</span><span class="p">)</span>
    <span class="n">add_defines</span><span class="p">(</span><span class="s2">"TEST1"</span><span class="p">)</span>

<span class="n">target</span><span class="p">(</span><span class="s2">"test2"</span><span class="p">)</span>
    <span class="n">set_kind</span><span class="p">(</span><span class="s2">"shared"</span><span class="p">)</span>
    <span class="n">add_files</span><span class="p">(</span><span class="s2">"src/*.c"</span><span class="p">)</span>
    <span class="n">add_defines</span><span class="p">(</span><span class="s2">"TEST2"</span><span class="p">)</span>
</code></pre>
</div>

<p>For example, the above configuration has two targets, each with its own independent macro definition: <code class="highlighter-rouge">TEST1</code> and<code class="highlighter-rouge"> TEST2</code>.</p>

<p>So, we need to set a common macro definition for these two targets. How should we configure it?</p>

<p><code class="highlighter-rouge">add_defines("TEST")</code> is configured under each target? Of course it can, but this is a bit redundant, and it will be difficult to maintain if you configure more. In fact, we only need to place it in the global root scope:</p>

<div class="language-lua highlighter-rouge"><pre class="highlight"><code><span class="c1">-- global settings</span>
<span class="n">add_defines</span><span class="p">(</span><span class="s2">"TEST"</span><span class="p">)</span>
<span class="k">if</span> <span class="n">is_arch</span><span class="p">(</span><span class="s2">"arm64"</span><span class="p">,</span> <span class="s2">"armv7"</span><span class="p">)</span> <span class="k">then</span>
    <span class="n">add_defines</span><span class="p">(</span><span class="s2">"ARM"</span><span class="p">)</span>
<span class="k">end</span>

<span class="n">target</span><span class="p">(</span><span class="s2">"test1"</span><span class="p">)</span>
    <span class="n">set_kind</span><span class="p">(</span><span class="s2">"shared"</span><span class="p">)</span>
    <span class="n">add_files</span><span class="p">(</span><span class="s2">"src/*.c"</span><span class="p">)</span>
    <span class="n">add_defines</span><span class="p">(</span><span class="s2">"TEST1"</span><span class="p">)</span>

<span class="n">target</span><span class="p">(</span><span class="s2">"test2"</span><span class="p">)</span>
    <span class="n">set_kind</span><span class="p">(</span><span class="s2">"shared"</span><span class="p">)</span>
    <span class="n">add_files</span><span class="p">(</span><span class="s2">"src/*.c"</span><span class="p">)</span>
    <span class="n">add_defines</span><span class="p">(</span><span class="s2">"TEST2"</span><span class="p">)</span>
</code></pre>
</div>

<p>All configurations outside the target belong to the global configuration. We can also call <code class="highlighter-rouge">target_end()</code> to forcibly end the target subdomain and switch back to the global scope:</p>

<div class="language-lua highlighter-rouge"><pre class="highlight"><code><span class="n">target</span><span class="p">(</span><span class="s2">"test1"</span><span class="p">)</span>
    <span class="n">set_kind</span><span class="p">(</span><span class="s2">"shared"</span><span class="p">)</span>
    <span class="n">add_files</span><span class="p">(</span><span class="s2">"src/*.c"</span><span class="p">)</span>
    <span class="n">add_defines</span><span class="p">(</span><span class="s2">"TEST1"</span><span class="p">)</span>
<span class="n">target_end</span><span class="p">()</span>

<span class="c1">-- global settings</span>
<span class="n">add_defines</span><span class="p">(</span><span class="s2">"TEST"</span><span class="p">)</span>
<span class="k">if</span> <span class="n">is_arch</span><span class="p">(</span><span class="s2">"arm64"</span><span class="p">,</span> <span class="s2">"armv7"</span><span class="p">)</span> <span class="k">then</span>
    <span class="n">add_defines</span><span class="p">(</span><span class="s2">"ARM"</span><span class="p">)</span>
<span class="k">end</span>

<span class="n">target</span><span class="p">(</span><span class="s2">"test2"</span><span class="p">)</span>
    <span class="n">set_kind</span><span class="p">(</span><span class="s2">"shared"</span><span class="p">)</span>
    <span class="n">add_files</span><span class="p">(</span><span class="s2">"src/*.c"</span><span class="p">)</span>
    <span class="n">add_defines</span><span class="p">(</span><span class="s2">"TEST2"</span><span class="p">)</span>
<span class="n">target_end</span><span class="p">()</span>
</code></pre>
</div>

<h3 id="add-compilation-options">Add compilation options</h3>

<p>If there are some compilation options, xmake does not provide built-in api settings, then we can degenerate to <code class="highlighter-rouge">add_cflags</code>,<code class="highlighter-rouge"> add_cxflags</code>, <code class="highlighter-rouge">add_cxxflags</code> to set,
However, this requires the user to determine the compilation platform, because not all compilation flags are supported on every platform.</p>

<p>such as:</p>

<div class="language-lua highlighter-rouge"><pre class="highlight"><code><span class="n">add_cflags</span><span class="p">(</span><span class="s2">"-g"</span><span class="p">,</span> <span class="s2">"-O2"</span><span class="p">,</span> <span class="s2">"-DDEBUG"</span><span class="p">)</span>
<span class="k">if</span> <span class="n">is_plat</span><span class="p">(</span><span class="s2">"windows"</span><span class="p">)</span> <span class="k">then</span>
    <span class="n">add_cflags</span><span class="p">(</span><span class="s2">"/MT"</span><span class="p">)</span>
<span class="k">end</span>
</code></pre>
</div>

<p>All option values are based on the definition of gcc as standard. If other compilers are not compatible (for example: vc), xmake will automatically convert them internally to option values supported by the corresponding compiler.
The user does not need to worry about its compatibility. If other compilers do not have corresponding matching values, xmake will automatically ignore the compiler settings.</p>

<p>We can also force the automatic detection of flags through the force parameter, and pass it directly to the compiler, even if the compiler may not support it, it will be set:</p>

<div class="language-lua highlighter-rouge"><pre class="highlight"><code><span class="n">add_cflags</span><span class="p">(</span><span class="s2">"-g"</span><span class="p">,</span> <span class="s2">"-O2"</span><span class="p">,</span> <span class="p">{</span><span class="n">force</span> <span class="o">=</span> <span class="kc">true</span><span class="p">})</span>
</code></pre>
</div>

<p>So how do you know which flags failed to be ignored, you can see with <code class="highlighter-rouge">-v</code> compilation, such as:</p>

<div class="language-bash highlighter-rouge"><pre class="highlight"><code><span class="gp">$ </span>xmake -v
checking <span class="k">for </span>the /usr/bin/xcrun -sdk macosx clang ... ok
checking <span class="k">for </span>the flags<span class="o">(</span>-Oz<span class="o">)</span> ... ok
checking <span class="k">for </span>the flags<span class="o">(</span>-Wno-error<span class="o">=</span>deprecated-declarations<span class="o">)</span> ... ok
checking <span class="k">for </span>the flags<span class="o">(</span>-fno-strict-aliasing<span class="o">)</span> ... ok
checking <span class="k">for </span>the flags<span class="o">(</span>-Wno-error<span class="o">=</span>expansion-to-defined<span class="o">)</span> ... no
</code></pre>
</div>

<p>Finally, note the differences between these three APIs:</p>

<ul>
  <li><code class="highlighter-rouge">add_cflags</code>: add only C code-related compilation flags</li>
  <li><code class="highlighter-rouge">add_cxflags</code>: add C/c++ code related flags</li>
  <li><code class="highlighter-rouge">add_cxxflags</code>: add only c++ code-related compilation flags</li>
</ul>

<h3 id="add-library-related-settings">Add library related settings</h3>

<p>For the integrated use of a C/c++ library, you usually need to set the header file search directory, link library name, and library search directory, such as:</p>

<div class="language-lua highlighter-rouge"><pre class="highlight"><code><span class="n">target</span><span class="p">(</span><span class="s2">"test"</span><span class="p">)</span>
    <span class="n">set_kind</span><span class="p">(</span><span class="s2">"binary"</span><span class="p">)</span>
    <span class="n">add_links</span><span class="p">(</span><span class="s2">"pthread"</span><span class="p">)</span>
    <span class="n">add_includedirs</span><span class="p">(</span><span class="s2">"/usr/local/include"</span><span class="p">)</span>
    <span class="n">add_linkdirs</span><span class="p">(</span><span class="s2">"/usr/local/lib"</span><span class="p">)</span>
</code></pre>
</div>

<p>Generally, in order to ensure the dependency order of the linked libraries, the system library links are usually backward. We use <code class="highlighter-rouge">add_syslinks()</code> to set the system library links specifically, and <code class="highlighter-rouge">add_links()</code> is usually used for non-system library links:</p>

<div class="language-lua highlighter-rouge"><pre class="highlight"><code><span class="n">target</span><span class="p">(</span><span class="s2">"test"</span><span class="p">)</span>
    <span class="n">set_kind</span><span class="p">(</span><span class="s2">"binary"</span><span class="p">)</span>
    <span class="n">add_links</span><span class="p">(</span><span class="s2">"A"</span><span class="p">,</span> <span class="s2">"B"</span><span class="p">)</span>
    <span class="n">add_syslinks</span><span class="p">(</span><span class="s2">"pthread"</span><span class="p">)</span>
</code></pre>
</div>

<p>In the above configuration, we added two third-party link libraries: A, B, and the system library pthread. The complete link sequence is: <code class="highlighter-rouge">-lA -lB -lpthread</code>, and syslinks will be placed at the end.</p>

<p>If you are unsure of the actual linking order, we can execute <code class="highlighter-rouge">xmake -v</code> compilation to see the complete link parameter command line.</p>

<h3 id="setting-the-language-standard">Setting the language standard</h3>

<p>The c standard and c++ standard can be set at the same time, for example:</p>

<div class="language-lua highlighter-rouge"><pre class="highlight"><code><span class="c1">-- set the c code standard: c99, c++ code standard: c++ 11</span>
<span class="n">set_languages</span><span class="p">(</span><span class="s2">"c99"</span><span class="p">,</span> <span class="s2">"c++11"</span><span class="p">)</span>
</code></pre>
</div>

<p>Note: The specified standard is not set, and the compiler will compile according to this standard. After all, each compiler supports different strengths, but xmake will try its best to adapt to the current standard of the compilation tool.</p>

<p>For example: the compiler for windows vs does not support compiling c code according to the c99 standard, only c89 is supported, but xmake supports it as much as possible, so after setting the c99 standard,
xmake will compile c code according to c++ code mode, which solves the problem of c code compiling c99 under windows.</p>

<h3 id="set-compilation-optimization">Set compilation optimization</h3>

<p>xmake provides several built-in compilation optimization configurations: none, fast, faster, fastest, smallest, aggressive, to achieve various levels of compilation optimization.</p>

<div class="language-lua highlighter-rouge"><pre class="highlight"><code><span class="n">set_optimize</span><span class="p">(</span><span class="s2">"fastest"</span><span class="p">)</span>
</code></pre>
</div>

<p>If you set it through flags, you also need to consider the different compilation options of different compilers. Xmake has an internal mapping process for it, which greatly facilitates users to provide cross-platform.</p>

<p>If you want to view detailed mapping rules, you can go to the official documentation of xmake to check it: <a href="https://xmake.io/#/zh-cn/manual/project_target?id=targetset_optimize">Compile Optimization Settings</a></p>

<h3 id="debug-and-release-mode">Debug and Release Mode</h3>

<p>Even though xmake provides <code class="highlighter-rouge">set_optimize</code> to simplify the complicated configuration of different compilers, for different compilation modes: debug/release, you still have to make some tedious judgments and configurations yourself:</p>

<div class="language-lua highlighter-rouge"><pre class="highlight"><code><span class="k">if</span> <span class="n">is_mode</span><span class="p">(</span><span class="s2">"debug"</span><span class="p">)</span> <span class="k">then</span>
    <span class="n">set_symbols</span><span class="p">(</span><span class="s2">"debug"</span><span class="p">)</span>
    <span class="n">set_optimize</span><span class="p">(</span><span class="s2">"none"</span><span class="p">)</span>
<span class="k">end</span>
<span class="k">if</span> <span class="n">is_mode</span><span class="p">(</span><span class="s2">"release"</span><span class="p">)</span> <span class="k">then</span>
    <span class="n">set_symbols</span><span class="p">(</span><span class="s2">"hidden"</span><span class="p">)</span>
    <span class="n">set_strip</span> <span class="p">(</span><span class="s2">"all"</span><span class="p">)</span>
    <span class="k">if</span> <span class="n">is_plat</span><span class="p">(</span><span class="s2">"iphoneos"</span><span class="p">,</span> <span class="s2">"android"</span><span class="p">)</span> <span class="k">then</span>
        <span class="n">set_optimize</span><span class="p">(</span><span class="s2">"smallest"</span><span class="p">)</span>
    <span class="k">else</span>
        <span class="n">set_optimize</span><span class="p">(</span><span class="s2">"fastest"</span><span class="p">)</span>
    <span class="k">end</span>
<span class="k">end</span>
</code></pre>
</div>

<p>These seemingly commonly used settings, if each project is repeated, it is also very tedious, resulting in xmake.lua not concise and readable, so xmake provides some commonly used built-in rules to simplify the setting:</p>

<div class="language-lua highlighter-rouge"><pre class="highlight"><code><span class="n">add_rules</span><span class="p">(</span><span class="s2">"mode.release"</span><span class="p">,</span> <span class="s2">"mode.debug"</span><span class="p">)</span>
</code></pre>
</div>

<p>Only this line is needed, the effect is completely the same, and the user can also do some additional custom configurations to rewrite based on this:</p>

<div class="language-lua highlighter-rouge"><pre class="highlight"><code><span class="n">add_rules</span><span class="p">(</span><span class="s2">"mode.release"</span><span class="p">,</span> <span class="s2">"mode.debug"</span><span class="p">)</span>
<span class="k">if</span> <span class="n">is_mode</span><span class="p">(</span><span class="s2">"release"</span><span class="p">)</span> <span class="k">then</span>
    <span class="n">set_optimize</span><span class="p">(</span><span class="s2">"fastest"</span><span class="p">)</span>
<span class="k">end</span>
</code></pre>
</div>

<p>For example, I want to force fastest compilation optimization in release mode. Now that we have a mode configuration, how do we switch to debug mode compilation? (Default is release compilation)</p>

<p>answer:</p>

<div class="language-lua highlighter-rouge"><pre class="highlight"><code><span class="n">xmake</span> <span class="n">f</span> <span class="o">-</span><span class="n">m</span> <span class="n">debug</span><span class="p">;</span>
<span class="n">xmake</span>
</code></pre>
</div>

<h3 id="add-source-files">Add source files</h3>

<p>Finally, we introduce one of the most common and powerful settings of xmake, which is the configuration management of compiled source files: <code class="highlighter-rouge">add_files()</code>.</p>

<p>We can use this interface to add various source files supported by xmake, such as: c/c++, asm, objc, swift, go, dlang and other source files, and even: <code class="highlighter-rouge">.obj</code>, <code class="highlighter-rouge">.a/.lib</code>, etc. Binary objects and library files.</p>

<p>E.g:</p>

<div class="language-lua highlighter-rouge"><pre class="highlight"><code><span class="n">add_files</span><span class="p">(</span><span class="s2">"src/test_*.c"</span><span class="p">)</span>
<span class="n">add_files</span><span class="p">(</span><span class="s2">"src/xxx/**.cpp"</span><span class="p">)</span>
<span class="n">add_files</span><span class="p">(</span><span class="s2">"src/asm/*.S"</span><span class="p">,</span> <span class="s2">"src/objc/**/hello.m"</span><span class="p">)</span>
</code></pre>
</div>

<p>The wildcard <code class="highlighter-rouge">*</code> matches files in the current directory, while <code class="highlighter-rouge">**</code> matches files in multiple directories.</p>

<p>The use of <code class="highlighter-rouge">add_files</code> is actually quite flexible and convenient. Its matching pattern borrows the style of premake, but it is improved and enhanced.</p>

<p>This makes it possible not only to match files, but also to filter out a batch of files with a specified pattern while adding files.</p>

<p>E.g:</p>

<div class="language-lua highlighter-rouge"><pre class="highlight"><code><span class="c1">-- Recursively add all c files under src, but not all c files under src/impl/</span>
<span class="n">add_files</span><span class="p">(</span><span class="s2">"src/**.c|impl/*.c"</span><span class="p">)</span>

<span class="c1">-- Add all cpp files under src, but exclude src/test.cpp, src/hello.cpp and all cpp files with xx_ prefix under src</span>
<span class="n">add_files</span><span class="p">(</span><span class="s2">"src/*.cpp|test.cpp|hello.cpp|xx_*.cpp"</span><span class="p">)</span>
</code></pre>
</div>

<p>The files after the delimiter <code class="highlighter-rouge">|</code> are all files that need to be excluded. These files also support matching patterns, and multiple filtering patterns can be added at the same time, as long as they are separated by <code class="highlighter-rouge">|</code>. .</p>

<p>One of the benefits of supporting filtering some files when adding files is that it can provide a basis for subsequent addition of files based on different switch logic.</p>

<p>Note: In order to make the description more concise, the filtering description after <code class="highlighter-rouge">|</code> is based on a pattern: the directory before <code class="highlighter-rouge">*</code> in <code class="highlighter-rouge">src/*.cpp</code>.
So the above example filters the files under src, which should be noted.</p>

<p>After 2.1.6, <code class="highlighter-rouge">add_files</code> has been improved to support more fine-grained compilation option control based on files, for example:</p>

<div class="language-lua highlighter-rouge"><pre class="highlight"><code><span class="n">target</span><span class="p">(</span><span class="s2">"test"</span><span class="p">)</span>
    <span class="n">add_defines</span><span class="p">(</span><span class="s2">"TEST1"</span><span class="p">)</span>
    <span class="n">add_files</span><span class="p">(</span><span class="s2">"src/*.c"</span><span class="p">)</span>
    <span class="n">add_files</span><span class="p">(</span><span class="s2">"test/*.c"</span><span class="p">,</span> <span class="s2">"test2/test2.c"</span><span class="p">,</span> <span class="p">{</span><span class="n">defines</span> <span class="o">=</span> <span class="s2">"TEST2"</span><span class="p">,</span> <span class="n">languages</span> <span class="o">=</span> <span class="s2">"c99"</span><span class="p">,</span> <span class="n">includedirs</span> <span class="o">=</span> <span class="s2">"."</span><span class="p">,</span> <span class="n">cflags</span> <span class="o">=</span> <span class="s2">"-O0"</span><span class="p">})</span>
</code></pre>
</div>

<p>You can pass a configuration table in the last parameter of <code class="highlighter-rouge">add_files</code> to control the compilation options of the specified files. The configuration parameters are the same as those of the target, and these files will inherit the target’s general configuration<code class="highlighter-rouge"> -DTEST1</code>.</p>

<p>After version 2.1.9, it supports adding unknown code files. By setting rule customization rules, these files can be custom built, for example:</p>

<div class="language-lua highlighter-rouge"><pre class="highlight"><code><span class="n">target</span><span class="p">(</span><span class="s2">"test"</span><span class="p">)</span>
    <span class="c1">-- ...</span>
    <span class="n">add_files</span><span class="p">(</span><span class="s2">"src/test/*. md"</span><span class="p">,</span> <span class="p">{</span><span class="n">rule</span> <span class="o">=</span> <span class="s2">"markdown"</span><span class="p">})</span>
</code></pre>
</div>

<p>And after version 2.1.9, you can use the force parameter to forcibly disable the automatic detection of cxflags, cflags and other compilation options, and pass it directly to the compiler, even if the compiler may not support it, it will be set:</p>

<div class="language-lua highlighter-rouge"><pre class="highlight"><code><span class="n">add_files</span><span class="p">(</span><span class="s2">"src/*.c"</span><span class="p">,</span> <span class="p">{</span><span class="n">force</span> <span class="o">=</span> <span class="p">{</span><span class="n">cxflags</span> <span class="o">=</span> <span class="s2">"-DTEST"</span><span class="p">,</span> <span class="n">mflags</span> <span class="o">=</span> <span class="s2">"-framework xxx"</span><span class="p">}})</span>
</code></pre>
</div>

<h3 id="delete-the-specified-source-file">Delete the specified source file</h3>

<p>Now that we ’ve talked about adding source files, how to delete them, let ’s just drop in. We only need to use the <code class="highlighter-rouge">del_files()</code> interface to delete the specified files from the list of files added by the <code class="highlighter-rouge">add_files</code> interface. :</p>

<div class="language-lua highlighter-rouge"><pre class="highlight"><code><span class="n">target</span><span class="p">(</span><span class="s2">"test"</span><span class="p">)</span>
    <span class="n">add_files</span><span class="p">(</span><span class="s2">"src/*.c"</span><span class="p">)</span>
    <span class="n">del_files</span><span class="p">(</span><span class="s2">"src/test.c"</span><span class="p">)</span>
</code></pre>
</div>

<p>In the above example, you can add all files except <code class="highlighter-rouge">test.c</code> from the<code class="highlighter-rouge"> src</code> directory. Of course, this can also be achieved by <code class="highlighter-rouge">add_files("src/*.c|test.c")</code>. But this approach is more flexible.</p>

<p>For example, we can use conditional judgment to control which files are deleted, and this interface also supports <code class="highlighter-rouge">add_files</code> matching mode, filtering mode, and batch removal.</p>

<div class="language-lua highlighter-rouge"><pre class="highlight"><code><span class="n">target</span><span class="p">(</span><span class="s2">"test"</span><span class="p">)</span>
    <span class="n">add_files</span><span class="p">(</span><span class="s2">"src/**.c"</span><span class="p">)</span>
    <span class="n">del_files</span><span class="p">(</span><span class="s2">"src/test * .c"</span><span class="p">)</span>
    <span class="n">del_files</span><span class="p">(</span><span class="s2">"src/subdir/*.c|xxx.c"</span><span class="p">)</span>
    <span class="k">if</span> <span class="n">is_plat</span><span class="p">(</span><span class="s2">"iphoneos"</span><span class="p">)</span> <span class="k">then</span>
        <span class="n">add_files</span><span class="p">(</span><span class="s2">"xxx.m"</span><span class="p">)</span>
    <span class="k">end</span>
</code></pre>
</div>

<p>Through the above example, we can see that <code class="highlighter-rouge">add_files</code> and<code class="highlighter-rouge"> del_files</code> are added and deleted sequentially according to the calling order, and delete one by <code class="highlighter-rouge">del_files("src/subdir/*.c|xxx.c")</code> Batch file,
And exclude <code class="highlighter-rouge">src/subdir/xxx.c</code> (that is, do not delete this file).</p>

        </article>
        <hr>

        <!-- baidu ads -->
        

        
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
            
                
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
            
        
            
            
                
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
            
                
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
            
                
            
        
            
            
                
            
        
            
            
                
            
        
            
            
                
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
            
            
                
                    
                    <h2 id="chinese">中文</h2>
                    <ul>
                    
                    <li class="relatedPost">
                        <a href="/cn/2019/11/10/quickstart-4-basic-project-settings/">xmake从入门到精通4：常用C/C++项目描述设置详解
                        
                        </a>
                    </li>
                    
                    
                
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
            
                
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
            
                
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
            
                
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
            
                
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
            
                
            
        
            
            
                
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
            
                
            
        
            
            
                
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
            
                
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
            
                
            
        
            
            
                
            
        
            
            
                
            
        
            
            
                
            
        
            
            
                
            
        
            
            
                
            
        
            
            
                
            
        
            
            
                
            
        
            
            
                
            
        
            
            
                
            
        
            
            
                
            
        
            
            
                
            
        
            
            
                
            
        
            
            
                
            
        
            
            
                
            
        
            
            
                
            
        
            
            
                
            
        
            
            
                
            
        
            
            
                
            
        
            
            
                
            
        
            
            
                
            
        
            
            
                
            
        
            
            
                
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
            
                
            
        
            
            
                
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
            
        
            
            
                
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
            
        
            
        
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
            
                
            
        
            
            
                
            
        
            
            
                
            
        
            
            
                
            
        
            
            
                
            
        
            
            
                
            
        
            
            
                
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
            
                
            
        
            
            
                
            
        
            
            
                
            
        
            
            
                
            
        
            
            
                
            
        
            
            
                
            
        
            
            
                
            
        
            
            
                
            
        
            
            
                
            
        
            
            
                
            
        
            
            
                
            
        
            
            
                
            
        
            
            
                
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
        
            </ul>
        

        
        
            
            
            
                
                    
                        
                        <h2 id="similar_posts">Similar Posts</h2>
                        <ul>
                        
                        <li class="relatedPost">
                            <a href="/2021/12/17/xmake-update-v2.6.2/">Xmake v2.6.2 released, Support building Linux kernel driver module
                            
                            </a>
                        </li>
                        
                        
                    
                
                    
                
                    
                
                    
                
                    
                
            
                
                    
                
                    
                
                    
                
                    
                
                    
                
            
                
                    
                
                    
                
                    
                
                    
                
                    
                
            
                
                    
                
                    
                
                    
                
                    
                
                    
                
            
                
                    
                
                    
                
                    
                
                    
                
                    
                
            
            
        
            
        
            
            
            
                
                    
                        
                        <li class="relatedPost">
                            <a href="/2021/12/03/xmake-update-v2.6.1/">xmake v2.6.1 released, Switch to Lua5.4 runtime, Support Rust and C++ mixed compilation
                            
                            </a>
                        </li>
                        
                        
                    
                
                    
                
                    
                
                    
                
                    
                
            
                
                    
                
                    
                
                    
                
                    
                
                    
                
            
                
                    
                
                    
                
                    
                
                    
                
                    
                
            
                
                    
                
                    
                
                    
                
                    
                
                    
                
            
                
                    
                
                    
                
                    
                
                    
                
                    
                
            
                
                    
                
                    
                
                    
                
                    
                
                    
                
            
                
                    
                
                    
                
                    
                
                    
                
                    
                
            
            
        
            
        
            
            
            
                
                    
                        
                        <li class="relatedPost">
                            <a href="/2021/10/30/xmake-update-v2.5.9/">xmake v2.5.9 released, Improve C++20 Modules and support Nim, Keil MDK and Unity Build
                            
                            </a>
                        </li>
                        
                        
                    
                
                    
                
                    
                
                    
                
                    
                
            
                
                    
                
                    
                
                    
                
                    
                
                    
                
            
                
                    
                
                    
                
                    
                
                    
                
                    
                
            
                
                    
                
                    
                
                    
                
                    
                
                    
                
            
                
                    
                
                    
                
                    
                
                    
                
                    
                
            
                
                    
                
                    
                
                    
                
                    
                
                    
                
            
                
                    
                
                    
                
                    
                
                    
                
                    
                
            
                
                    
                
                    
                
                    
                
                    
                
                    
                
            
                
                    
                
                    
                
                    
                
                    
                
                    
                
            
                
                    
                
                    
                
                    
                
                    
                
                    
                
            
                
                    
                
                    
                
                    
                
                    
                
                    
                
            
                
                    
                
                    
                
                    
                
                    
                
                    
                
            
            
        
            
        
            
            
            
                
                    
                        
                        <li class="relatedPost">
                            <a href="/2021/10/08/xmake-update-v2.5.8/">xmake v2.5.8 is released, Support Pascal/Swig program and Lua53 runtime
                            
                            </a>
                        </li>
                        
                        
                    
                
                    
                
                    
                
                    
                
                    
                
            
                
                    
                
                    
                
                    
                
                    
                
                    
                
            
                
                    
                
                    
                
                    
                
                    
                
                    
                
            
                
                    
                
                    
                
                    
                
                    
                
                    
                
            
                
                    
                
                    
                
                    
                
                    
                
                    
                
            
                
                    
                
                    
                
                    
                
                    
                
                    
                
            
            
        
            
        
            
            
            
                
                    
                        
                        <li class="relatedPost">
                            <a href="/2021/08/29/xmake-update-v2.5.7/">xmake v2.5.7 released, Use lockfile to freeze package dependencies and Vala/Metal language support
                            
                            </a>
                        </li>
                        
                        
                    
                
                    
                
                    
                
                    
                
                    
                
            
                
                    
                
                    
                
                    
                
                    
                
                    
                
            
                
                    
                
                    
                
                    
                
                    
                
                    
                
            
                
                    
                
                    
                
                    
                
                    
                
                    
                
            
                
                    
                
                    
                
                    
                
                    
                
                    
                
            
                
                    
                
                    
                
                    
                
                    
                
                    
                
            
            
        
            
        
        
            </ul>
        

        <div class="post-recent">
    <div class="pre">

        

        

        
        
        

        

        

        
        
        <p><strong>Prev Post</strong> <a href="/2019/11/09/quickstart-3-run-and-debug/">Xmake Getting Started Tutorial 3: Run and Debug Program</a></p>
        
    </div>

    <div class="nex">

        

        

        
        
        

        

        

        
        
        <p><strong>Next Post</strong> <a href="/2019/11/15/quickstart-5-build-android/">Xmake Getting Started Tutorial 5: Introduction to Android platform compilation</a></p>
        
    </div>
</div>


        <h2 id="comments">Comments</h2>
        






<div id="gitalk-container"></div>
<link rel="stylesheet" href="/css/gitalk.css">
<script src="/js/gitalk.min.js"></script>

<script>
const gitalk = new Gitalk({
  clientID: '73946dc1d9e2276ad0da',
  clientSecret: '12a3cb94361ba3ebc6ecb68cf80d592bfaa8106d',
  repo: 'tboox.github.io',
  owner: 'waruqi',
  admin: ['waruqi'],
  id: location.pathname,      
  language: 'en',
  distractionFreeMode: false  
})

gitalk.render('gitalk-container')
</script>





    </div>
    <button class="anchor"><i class="fa fa-anchor"></i></button>
    <div class="right">
        <div class="wrap">


            <!-- codefund ads -->
            

            <!-- Content -->
            <div class="side content">
                <div>
                    Content
                </div>
                <ul id="content-side" class="content-ul">
                    <li><a href="#chinese">中文</a></li>
                    <li><a href="#similar_posts">Similar Posts</a></li>
                    <li><a href="#comments">Comments</a></li>
                </ul>
            </div>

            <!-- baidu ads -->
            

            <br>
            <div class="side">
                <div>
                    <i class="fa fa-external-link"></i>
                    Links
                </div>
                <ul class="content-ul">
                  <li><a href="http://github.com/waruqi/tbox">tbox</a></li>
                  <li><a href="http://www.xmake.io">xmake</a></li>
                  <li><a href="https://github.com/waruqi">github</a></li>
                </ul>
            </div> 

            <!-- google ads -->
            

            <!-- baidu ads -->
            

            <!-- chitika ads -->
            
        </div>
    </div>

    <!-- baidu ads -->
    
</div>
<script>
/**
 * target _blank
 */
(function() {
    var aTags = document.querySelectorAll('article a:not([id])')
    for (var i = 0; i < aTags.length; i++) {
        aTags[i].setAttribute('target', '_blank')
    }
}());
</script>
<script src="/js/pageContent.js " charset="utf-8"></script>



    <footer class="site-footer">
    <div class="wrapper">
        <p class="description">
             Copyright (c) 2016-2020 tboox.org 
        </p>
        <p class="contact">
            
            <a href="https://github.com/waruqi" title="GitHub"><i class="fa fa-github" aria-hidden="true"></i></a> 
             
            
            <a href="mailto:waruqi@gmail.com" title="email"><i class="fa fa-envelope-o" aria-hidden="true"></i></a> 
            
            
            <a href="https://twitter.com/waruqi" title="Twitter"><i class="fa fa-twitter" aria-hidden="true"></i></a> 
            
            <a href="/feed.xml" title="feed"><i class="fa fa-feed" aria-hidden="true"></i></a> 
        </p>
        <p class="power">
            <span>
                Site powered by <a href="https://jekyllrb.com/">Jekyll</a> & <a href="https://github.com/Gaohaoyang">HyG</a> & <a href="https://pages.github.com/">Github Pages</a>.
            </span>
        </p>
    </div>
</footer>

    <div class="back-to-top">
    <a href="#top" class="scroll">
        <i class="fa fa-arrow-up" aria-hidden="true"></i>
    </a>
</div>

    <script src=" /js/main.js " charset="utf-8"></script>
    <script src=" /js/scroll.min.js " charset="utf-8"></script>
  </body>

</html>
